<template>
	<view class="page">
		<page-head :title="title"></page-head>
		<view class="uni-product-list">
			<view class="uni-product" v-for="(product,index) in productList" :key="index" @click="handleClick(index)">
				<view class="image-view">
					<image v-if="renderImage" class="uni-product-image" :src="product.image"></image>
				</view>
				<view class="uni-product-title" style="text-align: center;font-size: 20px;">{{product.title}}</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
    data() {
        return {
            title: '学院概况',
			productList: [],
            renderImage: false
        };
    },
    methods: {
        loadData(action = 'add') {
            const data = [
                {
                    image: 'http://www.hngsxy.com/projectresources/wxapp/dept/t90m1.png',
                    title: '学院简介'
                    // originalPrice: 9999,
                    // favourPrice: 8888,
                    // tip: '自营'
                },
                {
                    image: 'http://www.hngsxy.com/projectresources/wxapp/dept/t90m2.png',
                    title: '现任领导'
                    // originalPrice: 3499,
                    // favourPrice: 3399,
                    // tip: '优惠'
                }
            ]
            if (action === 'refresh') {
                this.productList = []
            }

            data.forEach(item => {
                this.productList.push(item)
            });
        },
		handleClick(i){
			// this.$set(this.productList,i,true);
			// console.log(this.productList);
			// console.log(i);
			if (i === 0){
				uni.navigateTo({
					url: '/pages_bd/details/details?newsId=28'
				});
			} else if(i === 1) {
				uni.navigateTo({
					url: '../dept/present_leader'
				});
			}
		}
    },
    onLoad() {
        this.loadData();
        setTimeout(()=> {
            this.renderImage = true
        }, 300)
    }
};
</script>

<style>
	
</style>
